package ia;

import book.Booklist;
import book.Book;

import java.sql.SQLOutput;
import java.util.Scanner;

public class Findbook implements IA {
    public void work(Booklist booklist){
        System.out.println("查找图书.........");

        Scanner SC = new Scanner(System.in);
        System.out.println("请输入你想要查找的书名");
        String bookname = SC.nextLine();

        int cutsize = booklist.getUsesize();
        for (int i = 0; i <cutsize ; i++) {
            Book book = booklist.getBooks(i);
            if(book.getTitle().equals(bookname)) {
                System.out.println("找到你想要的书了");
                System.out.println(booklist.getBooks(i));
                return;
                }
        }
        System.out.println("没有找到你想要的书");
    }
}
